package com.jyh.controller.basicBi;


import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.jyh.config.BaseAction;
import com.jyh.db.entity.JyhBasicData;
import com.jyh.service.basicBi.BasicService;
import com.jyh.util.Time;
import com.jyh.util.Utils;

@Controller
@RequestMapping(value = "/basic")
public class BasicController extends BaseAction {
	@Autowired
	private BasicService basicService;
	
	@RequestMapping("/new")
	public ModelAndView getBasicNew(){
		ModelAndView mv = new ModelAndView("basicBi/newDataStatistics");
		JyhBasicData vo =basicService.oldServe(Time.getTime());
		List<JyhBasicData> list = new ArrayList<JyhBasicData>();
		list.add(vo);
		mv.addObject("list", list);
		return mv;
	}
	
	@RequestMapping("/old")
	public ModelAndView getBasicNew(String orderTime1 ,String orderTime2){
		ModelAndView mv = new ModelAndView("basicBi/oldDataStatistics");
		if(Utils.isNull(orderTime1)||Utils.isNull(orderTime2)){
			orderTime1 = Time.getTimes();
			orderTime2 = Time.getTimes();
		}
		List<JyhBasicData> vo =basicService.ListOldData(orderTime1, orderTime2);
		mv.addObject("list", vo);
		mv.addObject("orderTime1", orderTime1);
		mv.addObject("orderTime2", orderTime2);
		return mv;
	}
	
	@RequestMapping("/past")
	public ModelAndView getBasicPast(){
		ModelAndView mv = new ModelAndView("basicBi/pastDataStatistics");
		JyhBasicData vo =basicService.oldServe("");
		List<JyhBasicData> list = new ArrayList<JyhBasicData>();
		list.add(vo);
		mv.addObject("list", list);
		return mv;
	}
}
